home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / tppop16.zip / POPDICE.PAS < prev    next >
Pascal/Delphi Source File  |  1988-09-29  |  2KB  |  61 lines

  1. {$R-,S-,I+,D+,T+,F-,V-,B-,N-,L+ }
  2. {$M 1024,5120,5120}
  3. Program PopUpDice;
  4.  
  5. Uses Crt,           { use the BIOS for video - REQUIRED }
  6.      Dice,          { dice rolling main unit            }
  7.      PopUp,         { low-level popup control routines  }
  8.      Windows;       { simple windowing package          }
  9.  
  10. Const
  11.   Version = '1.0';
  12.   Signature = $89;          { must be greater than $80 }
  13.  
  14. Var
  15.   CommandLine : ^String;
  16.   Hotkey      : Word;
  17.   Result      : Word;
  18.   Temp        : String[4];
  19.   ErrorCode   : Byte;
  20.  
  21. Procedure UpperCase(Var Line : String); External; {$L upprcase.obj}
  22.  
  23. Procedure Copyright;
  24.  
  25. Begin
  26.   WriteLn;
  27.   WriteLn('PopDice Version ',Version,' (c) Copyright 1988 Ross Neilson Wentworth');
  28.   WriteLn;
  29. End;
  30.  
  31. Begin
  32.   Copyright;                                  { display my name          }
  33.   ErrorCode := Installed(Signature);          { see if we can install    }
  34.   If ErrorCode <> 0 Then
  35.   Begin                                       { already or can't install }
  36.     Case ErrorCode Of
  37.       1 : WriteLn('This program must be loaded before PRINT.COM');
  38.       2 : WriteLn('Already Installed');
  39.       3 : WriteLn('Internal error, can''t install');
  40.     End;
  41.     Halt(ErrorCode);                          { return an error code     }
  42.   End;
  43.   CommandLine := Ptr(PrefixSeg,$0080);        { point to command line    }
  44.   UpperCase(CommandLine^);                    { convert to uppercase     }
  45.   Hotkey := Alt + LeftShift + $20;            { default hot key          }
  46.   If ParamCount > 0                           { user defined hot key?    }
  47.     Then Begin
  48.       Temp := ParamStr(1);             { convert command line to hot key }
  49.       Val('$'+Temp,HotKey,Result);
  50.       If (Result <> 0) or (Length(Temp) <> 4) Then
  51.       Begin                          { if error, halt with error message }
  52.         WriteLn('Error in HotKey definition!  Program aborted.',^G);
  53.         Halt(4);                              { return code }
  54.       End;
  55.       WriteLn('User defined HotKey!');
  56.     End
  57.   Else WriteLn('Press ALT + LeftShift + D to activate');
  58.   ReleaseEnvironment;                          { release unneeded memory     }
  59.   StayResident(Signature,@PopDice,HotKey);     { terminate and stay resident }
  60. End.
  61.